package com.dao;


import com.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserDaoWithAnnotation {

    @Select("select * from my_database.user_info where user_id=#{userId}")
    @Results({@Result(column = "user_id",property = "userId"),
              @Result(column = "user_name",property = "userName"),
              @Result(column = "user_Age",property = "userAge")})
    User getUser(int userId);

    @Select("select * from my_database.user_info")
    List<User> getUserList();
}
